package com.ssl.rms.service.impl;

import com.ssl.rms.entity.UserRole;
import com.ssl.rms.entity.UserRoleExample;
import com.ssl.rms.mapper.UserRoleMapper;
import com.ssl.rms.service.UserRoleService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 描述：用户-角色service实现类
 *
 * @author ssl
 * @create 2018/03/29 13:56
 */
@Service
public class UserRoleServiceImpl implements UserRoleService {
    private Logger logger = LoggerFactory.getLogger(getClass());
    @Autowired
    private UserRoleMapper userRoleMapper;

    /**
     * 查询用户拥有的觉得id集合
     *
     * @param userId
     * @return
     */
    @Override
    public List<UserRole> findRoles(Long userId) {
        UserRoleExample example = new UserRoleExample();
        UserRoleExample.Criteria criteria = example.createCriteria();
        criteria.andUserEqualTo(userId);
        return userRoleMapper.selectByExample(example);
    }
}
